import java.io.File;
import java.io.FileInputStream;
import java.io.InputStream;
import java.util.Properties;


public class ReadMail {
/*public void display(File emlFile) throws Exception{
        
        Properties props = System.getProperties();
        Session mailSession = Session.getDefaultInstance(props, null);
        InputStream inputStream = new FileInputStream(emlFile);   
        MimeMessage message = new MimeMessage(mailSession, inputStream);
        
        try {
            //Get the header information
            String from2 = ((InternetAddress) message.getFrom()[0]).getPersonal();
            if (from2 == null) {
                from2 = ((InternetAddress) message.getFrom()[0]).getAddress();
            }
            System.out.println("FROM2: " + from2);
            String subject = message.getSubject();
            System.out.println("SUBJECT: " + subject);
            
            String xx = message.getFrom()[0].toString().replaceAll("[<|>]", " ");
            String[] tt = xx.split(" ");
 
            for(int i=0;i<tt.length;i++){
                if(tt[i].contains("@")){
                    from = tt[i];
 
                System.out.println("From : " + from);
                }
            }
            
            // -- Get the message part (i.e. the message itself) --
            Part messagePart = message;
            Object content = messagePart.getContent();
            // -- or its first body part if it is a multipart message --
            if (content instanceof Multipart) {
                messagePart = ((Multipart) content).getBodyPart(0);
                System.out.println("[ Multipart Message ]");
            }
            // -- Get the content type --
            String contentType = messagePart.getContentType();
            // -- If the content is plain text, we can print it --
            System.out.println("CONTENT:" + contentType);
 
            if (contentType.startsWith("text/plain") || contentType.startsWith("text/html")) {
                InputStream is = messagePart.getInputStream();
                BufferedReader reader = new BufferedReader(new InputStreamReader(is));
                String thisLine;
                meld= "\n-------------------------------------------------------";
                while (( thisLine= reader.readLine()) != null) {
//                    System.out.println("thisLine: "+thisLine);
                    meld =  meld +"\n"+ thisLine;
                }
             }
            System.out.println("-----------------------------");
          
            setAbs(from);
            setBetreff(message.getSubject());
            setInhalt(meld);
            System.out.println("Meld: "+meld);
        } catch (Exception ex) {
            ex.printStackTrace();
        }        
    }
*/
}
